<%@page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@include file="/includes/taglibs.jsp"%>
<%@page import="com.feib.soeasy.util.UserUtil"%>
<%@page import="com.feib.soeasy.util.CodeTableUtil"%>
<%@page import="com.feib.soeasy.model.Payment"%>
<script type="text/javascript">
	<!--	
	$(document).ready(function() {	
		

		$('#printBtn2').click(function() {
			//window.print();
			//doQueryPrintAction();
			divPrint('paymentListDiv');//只印目前這筆
		});
		
		
		$("[id^='viewPaymentImg-']").click(function() {
			var uploadFilePk = this.id.substring(15);
			doQueryPaymentsAction(uploadFilePk);
			
		});
	});
	
	
	$("[id^='passPaymentBtn']").click(function() {
		doPaymentsConfirmAction(5);
	});
	$("[id^='cancelPaymentBtn']").click(function() {
		doPaymentsConfirmAction(2);
	});
	
	$("#checkAll").click(function() {
		doCheckAll();
	});
	$("#unCheckAll").click(function() {
		undoCheckAll();
	});
	//-->
</script>
<c:choose>
	<c:when test="${null != actionBean.queryPaymentResult && not empty actionBean.queryPaymentResult.paginatedList}">
	<stripes:form name="confirmHiddenFrom" id="confirmHiddenFrom" beanclass="com.feib.soeasy.action.Soez2005ActionBean" 
		method="post" onsubmit="javascript: return false;">		
				
		<table id="listTable">
			<thead>
				<tr>
					<th>繳費帳號</th>
					<th>姓名</th>
					<th>繳費金額</th>
					<th>繳費期限</th>
					<th>銷帳人員</th>
					<th>銷帳日期</th>
					<th>原因</th>
					<th>繳費明細</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${actionBean.queryPaymentResult.paginatedList}" var="viewObj" varStatus="rowstat">
				<tr>
					<td><input name="checkPayment[${rowstat.index}].paymentPk" type="checkbox" id="checkPayment[${rowstat.index}].paymentPk" value="<c:out value='${viewObj.paymentPk}'/>" class="chk"/>
					<c:out value="${viewObj.virtualAccount}"/></td>
					<td><c:out value="${viewObj.payerName}"/></td>
					<td align="right"><fmt:formatNumber value="${viewObj.totalAmount}" pattern="##,###" /></td>
					<td align="center"><fmt:formatDate value="${viewObj.payDue}" pattern="yyyy/MM/dd" /></td>
					<td><c:out value="${viewObj.writeOffPayment.writeOffUser.userName}"/></td> 
					<td align="center"><fmt:formatDate value="${viewObj.writeOffPayment.writeOffDate}" pattern="yyyy/MM/dd" /><br/>
						<fmt:formatDate value="${viewObj.writeOffPayment.writeOffDate}" pattern="HH:mm:ss" />
					</td>
					<td><c:out value="${viewObj.writeOffPayment.writeOffNote}"/></td>
					<td>
						<div id="viewPaymentImg-<c:out value='${viewObj.paymentPk}'/>"><a href="javascript: void(0)" class="btnZoom">查詢</a></div>
					</td>					
				</tr>
				</c:forEach>
			</tbody>
		</table>
		<table width="100%">
			<tr>
				<td align="center"><stripes:hidden id="hidden.qryPayment.paymentStatus" name="qryPayment.paymentStatus"/>
					<input type="button" 
						id="checkAll" name="checkAll" 
						value="全選">
					<input type="button" 
						id="unCheckAll" name="unCheckAll" 
						value="全不選">
					<input type="button" 
						id="passPaymentBtn" name="passPaymentBtn" 
						value="放行">
					<input type="button" 
						id="cancelPaymentBtn" name="cancelPaymentBtn" 
						value="退件">
						<input type="button" id="printBtn2" value="列印" />	
				</td>
			</tr>
		</table>
	<input type="hidden" id="method" name="doAjaxPaymentsConfirm"/>
	</stripes:form>

		<script type="text/javascript">
		<!--
		$(document).ready(function() {			
			$("[id^='veiwFilePaymentsImg-']").click(function() {
				var filePk = this.id.substring(20);
				doQueryPaymentsAction(filePk);
			});
		});
		//-->
		</script>
	</c:when>
	<c:otherwise>
		<div id="queryNothingBlockDiv" style="display: none;">
			查無資料
		</div>		
		<script type="text/javascript">
		<!--
		$(document).ready(function() {
			$( "#queryNothingBlockDiv" ).dialog( "destroy" );
			$( "#queryNothingBlockDiv" ).dialog({  title:'<%=UserUtil.getCurrentMenuItemName() %>查詢' ,width: 300 ,resizable: false, modal: true, buttons : {
				Ok : function() {
					$(this).dialog("close");
				}
			}  });
		});
		//-->
		</script>
	</c:otherwise>
</c:choose>
